<!DOCTYPE html>
<html class="pixel-ratio-3 retina android android-5 android-5-1-1">
<head>
    <title>问诊单详情</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="">

    <link rel="stylesheet" href="/lib/weui.min.css">
    <link rel="stylesheet" href="/css/jquery-weui.css">
    <link rel="stylesheet" href="/css/home.css">
    <link rel="stylesheet" href="/plugins/fontaw/css/font-awesome.css">
<style>

</style>
</head>
<body ontouchstart >
<div class="kk-container" id="detailList" >
<!--    <div style="text-align: center">
        <p>请认证填写问诊单各项信息</p>
    </div>
    <div class="kk-black-border" >
        <h3 style="text-align: center">饮食情况</h3>
        <p style="font-size:0.8rem;font-weight:bold;margin:0.3rem 0rem">喝水</p>
        <div>
            <ul class="kk-ul" style="font-size:0.6rem">
                <li><label><input type="radio" name="a" value="" />喝水多</label> </li>
                <li><label><input name="a" type="radio" />喝水少 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
            </ul>
            <div style="clear:both;border-bottom: #cccccc dashed 1px;margin:0  auto"></div>
        </div>
        <p style="font-size:0.8rem;font-weight:bold;margin:0.3rem 0rem">喝水</p>
        <div>
            <ul class="kk-ul" style="font-size:0.6rem">
                <li><label><input name="a" type="checkbox" />喝水多喝水多喝水多 </label></li>
                <li><label><input name="a" type="checkbox" />喝水多 </label></li>
                <li><label><input name="a" type="checkbox" />喝水多 </label></li>
                <li><label><input name="a" type="checkbox" />喝水多 </label></li>
                <li><label><input name="a" type="checkbox" />喝水多 </label></li>
                <li><label><input name="a" type="checkbox" />喝水多 </label></li>
            </ul>
            <div style="clear:both;border-bottom: #cccccc dashed 1px;margin:0  auto"></div>
        </div>
        <p style="font-size:0.8rem;font-weight:bold;margin:0.3rem 0rem">其他说明</p>
        <div class="position:relative">
           <textarea style="width: 100%" rows="6"></textarea>
            <span>0/200</span>
        </div>
    </div>


    <div class="kk-black-border" >
        <h3 style="text-align: center">饮食情况</h3>
        <p style="font-size:0.8rem;font-weight:bold;margin:0.3rem 0rem">喝水</p>
        <div>
            <ul class="kk-ul" style="font-size:0.6rem">
                <li><label><input name="a" type="radio" />喝水多喝水多喝水多 </li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
            </ul>
            <div style="clear:both;border-bottom: #cccccc dashed 1px;margin:0  auto"></div>
        </div>
        <p style="font-size:0.8rem;font-weight:bold;margin:0.3rem 0rem">喝水</p>
        <div>
            <ul class="kk-ul" style="font-size:0.6rem">
                <li><label><input name="a" type="radio" />喝水多喝水多喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
                <li><label><input name="a" type="radio" />喝水多 </label></li>
            </ul>
            <div style="clear:both;border-bottom: #cccccc dashed 1px;margin:0  auto"></div>
        </div>
    </div>
    <div style="height: 3rem"></div>-->
</div>




<script src="/lib/jquery-2.1.4.js"></script>
<script src="/lib/fastclick.js"></script>
<script src="/js/jquery-weui.js"></script>
<script src="/js/home.js"></script>
<script src="/js/inquiry_init.js"></script>
<script>
    $(function(){
       var inquiryId = getQueryString("inquiryId");
        console.log(inquiryId);
        // 封装请求参数
        var data = {"inquiryId":inquiryId};
        $.ajax({
            url:"/template/getListByInquiryId",
            type:"post",
            dataType:"json",
            data:data,
            success:function(result){
                var detailList = "";
                // 迭代一级列表
                $(result.data.detailList).each(function(){
                   console.log(this.content);
                    detailList += "<div class='kk-black-border' ><h3 style='text-align: center'>"+this.content+"</h3>";
                    $(this.level2List).each(function(){

                        detailList += "<p style='font-size:0.8rem;font-weight:bold;margin:0.3rem 0rem'>"+this.content+"</p>";
                        if(this.categoryType == '简单'){
                            $(this.level3List).each(function(){

                                var text = "";
                                for(var i=0;i<result.data.subList.length;i++){
                                    //console.log(result.data.subList[i].subjectCode)
                                    if(result.data.subList[i].subjectCode==this.categoryCode){
                                        text = result.data.subList[i].answers;
                                    }
                                }
                                detailList += "<div class='position:relative'><textarea style='width: 100%' rows='6'>"+text+"</textarea><span>0/200</span></div>";

                            });
                        }else{
                            detailList += "<div><ul class='kk-ul' style='font-size:0.6rem'>";
                            if(this.categoryType == '单选'){
                                $(this.level3List).each(function(){
                                    var flag = false;
                                    for(var i=0;i<result.data.subList.length;i++){
                                        //console.log(result.data.subList[i].answers+"-----"+this.itemCode);
                                        if(result.data.subList[i].answers==this.itemCode){
                                            flag = true;
                                        }
                                    }
                                    if(flag){
                                        detailList += "<li><label><input name='"+this.categoryCode+"' type='radio' checked='checked' />"+this.itemTitle+"</label></li>";
                                    }else{
                                        detailList += "<li><label><input name='"+this.categoryCode+"' type='radio' />"+this.itemTitle+"</label></li>";
                                    }
                                });
                            }else if(this.categoryType == '多选'){
                                $(this.level3List).each(function(){
                                    var flag = false;
                                    for(var i=0;i<result.data.subList.length;i++){
                                        if(result.data.subList[i].answers.indexOf(",")){
                                            var arr = result.data.subList[i].answers.split(",");
                                            for(var j=0;j<arr.length;j++){
                                                if(arr[j]==this.itemCode){
                                                    flag = true;
                                                }
                                            }
                                        }
                                    }
                                    if(flag){
                                        detailList += "<li><label><input name='a' type='checkbox' checked='checked' />"+this.itemTitle+"</label></li>";
                                    }else{
                                        detailList += "<li><label><input name='a' type='checkbox' />"+this.itemTitle+"</label></li>";
                                    }

                                });
                            }
                            detailList += "</ul><div style='clear:both;border-bottom: #cccccc dashed 1px;margin:0  auto'></div></div>";
                        }
                    });
                    detailList +="</div>";
                });
                $("#detailList").html(detailList);
            },error:function(){
                console.log("ajax出错");
            }
        });
    });
</script>
</body>
</html>